const { order: orderConst } = require('../constant')

module.exports = mongoose => {
  const OrderSchema = new mongoose.Schema({
    user_id: {type: mongoose.Schema.Types.ObjectId},
    title: {type: String},
    target_country: {type: String},
    website_link: {type: String},
    keywords: {type: String},
    email_addr: {type: String},
    phone: {type: String},
    need: {type: String},
    status: {type: String, enum: orderConst.statusEnum, default: orderConst.statusEnum[0]},
    create_time: {type: Date, default: Date.now()},
    update_time: {type: Date, default: Date.now()},
    price: {type: Number, default: 0}
  }, {
    collection: 'order'
  })

  return mongoose.model('Order', OrderSchema)
}
